<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <title>ADA Airlines</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

        <!-- CSS Styles -->
        <link rel="stylesheet" href="css/reset.css" type="text/css" media="all">
        <link rel="stylesheet" href="css/layout.css" type="text/css" media="all">
        <link rel="stylesheet" href="css/style.css" type="text/css" media="all">

        <meta name="viewport" content="width=device-width">
        <script>
            function verificaChecks() {
                if (contrato.checked === false) {
                    alert("Você deve concordar com as regras tarifárias e restrições de bagagens para continuar.!");
                    contrato.focus();
                    return false;
                }
            }
        </script>    

    </head>
    <body id="page1">
        <div class="main">
            <!--header -->
            <header>
                <div class="wrapper">
                    <h1><a href="index.html" id="logo">Air lines</a></h1>
                    <span id="slogan">Voos Rápidos, Frequentes e Seguros</span>
                </div>
                <nav>
                    <ul id="menu">
                        <li><a href="index.html"><span><span>Home</span></span></a></li>
                        <li id="menu_active"><a href="passagens.jsp"><span><span>Passagens</span></span></a></li>
                        <li><a href="incluiCadastro.jsp"><span><span>Cadastre-se</span></span></a></li>
                        <li class="end"><a href="login.jsp"><span><span>Log in</span></span></a></li>
                    </ul>
                </nav>
            </header>
            <!-- / header -->
            <!--body -->
            <form method="post" action="confirmaCompra" onsubmit="return verificaChecks()">
                <script type="text/javascript" src="js/passagens.js"></script>
                <h4> Passagens de Ida </h4>
                <table style="border: 1px solid black;" cellspacing="0">
                    <tr valign="baseline" bgcolor="#404060">
                        <th align="center" style="border: 1px solid black; width: 60px">Voo</th>
                        <th align="center" style="border: 1px solid black; width: 80px">Data</th>
                        <th align="center" style="border: 1px solid black; width: 80px">Hora de Partida</th>
                        <th align="center" style="border: 1px solid black; width: 80px">Hora de Chegada</th>
                        <th align="center" style="border: 1px solid black; width: 80px">Duração</th>
                        <th align="center" style="border: 1px solid black; width: 200px">Origem</th>
                        <th align="center" style="border: 1px solid black; width: 200px">Destino</th>
                        <th align="center" style="border: 1px solid black; width: 200px">Classe Economica</th>
                        <th align="center" style="border: 1px solid black; width: 200px">Classe Executiva</th>
                    </tr>
                    <c:forEach var="voo" items="${VoosDisponiveisIda}">
                        <tr style="border: 1px solid black;">
                            <td style="border: 1px solid black;">
                                <c:out value="${voo.codigo}" />
                            </td>
                            <td style="border: 1px solid black;">
                                <c:out value="${voo.data}" />
                            </td>
                            <td style="border: 1px solid black;">
                                <c:out value="${voo.hr_destino}" />
                            </td>
                            <td style="border: 1px solid black;">
                                <c:out value="${voo.hr_chegada}" />
                            </td>
                            <td style="border: 1px solid black;">
                                <c:out value="${voo.duracao}" />
                            </td>
                            <td style="border: 1px solid black;">
                                <c:out value="${voo.origem.nome}" />
                            </td>
                            <td style="border: 1px solid black;">
                                <c:out value="${voo.destino.nome}" />
                            </td>
                            <td style="border: 1px solid black;">
                                <input type="radio" name="select_econ_ida" value="${voo.codigo}"/>
                                <label>R$</label><c:out value="${detalhesPassagem.preco.precoEconomico}" />
                                <label><br><c:out value="Lugares disponíveis: ${voo.lugaresEconomica}" /></label>
                            </td>
                            <td style="border: 1px solid black;">
                                <input type="radio" name="select_exec_ida" value="${voo.codigo}"/>
                                <label>R$</label><c:out value="${detalhesPassagem.preco.precoExecutivo}" />
                                <label><br><c:out value="Lugares disponíveis: ${voo.lugaresExecutiva}" /></label>
                            </td>
                        </tr>
                    </c:forEach>
                </table>
                <br><br>
                <c:if test="${detalhesPassagem.idaEvolta}">
                    <h4> Passagens de Volta </h4>
                    <table style="border: 1px solid black;" cellspacing="0">
                        <tr valign="baseline" bgcolor="#404060">
                            <th align="center" style="border: 1px solid black; width: 60px">Voo</th>
                            <th align="center" style="border: 1px solid black; width: 80px">Data</th>
                            <th align="center" style="border: 1px solid black; width: 80px">Hora de Partida</th>
                            <th align="center" style="border: 1px solid black; width: 80px">Hora de Chegada</th>
                            <th align="center" style="border: 1px solid black; width: 80px">Duração</th>
                            <th align="center" style="border: 1px solid black; width: 200px">Origem</th>
                            <th align="center" style="border: 1px solid black; width: 200px">Destino</th>
                            <th align="center" style="border: 1px solid black; width: 200px">Classe Economica</th>
                            <th align="center" style="border: 1px solid black; width: 200px">Classe Executiva</th>
                        </tr>
                        <c:forEach var="voo" items="${VoosDisponiveisVolta}">
                            <tr style="border: 1px solid black;">
                                <td style="border: 1px solid black;">
                                    <c:out value="${voo.codigo}" />
                                </td>
                                <td style="border: 1px solid black;">
                                    <c:out value="${voo.data}" />
                                </td>
                                <td style="border: 1px solid black;">
                                    <c:out value="${voo.hr_destino}" />
                                </td>
                                <td style="border: 1px solid black;">
                                    <c:out value="${voo.hr_chegada}" />
                                </td>
                                <td style="border: 1px solid black;">
                                    <c:out value="${voo.duracao}" />
                                </td>
                                <td style="border: 1px solid black;">
                                    <c:out value="${voo.origem.nome}" />
                                </td>
                                <td style="border: 1px solid black;">
                                    <c:out value="${voo.destino.nome}" />
                                </td>
                                <td style="border: 1px solid black;">
                                    <input type="radio" name="select_econ_volta" value="${voo.codigo}"/>
                                    <label>R$</label><c:out value="${detalhesPassagem.preco.precoEconomico}" />
                                    <label><br><c:out value="Lugares disponíveis: ${voo.lugaresEconomica}" /></label>
                                </td>
                                <td style="border: 1px solid black;">
                                    <input type="radio" name="select_exec_volta" value="${voo.codigo}"/>
                                    <label>R$</label><c:out value="${detalhesPassagem.preco.precoExecutivo}" />
                                    <label><br><c:out value="Lugares disponíveis:  ${voo.lugaresExecutiva}" /></label>
                                </td>
                            </tr>
                        </c:forEach>
                    </table>
                </c:if>
                <input type="checkbox" id = "necessidadeEspecial" name="necessidadeEspecial" onClick="necessidadesEspeciais('necessidadeEspecial', 'descricaoNecessidadeEspecial')"><span> Necessito de serviços especiais.</span></input>
                <input type="text" class="input2" maxlength="100" id="descricaoNecessidadeEspecial" name="descricaoNecessidadeEspecial" >
                <br>
                <input type="checkbox" id = "contrato" name="contrato"><span> Li e estou de acordo com o <a href="contrato.pdf" target="blank">contrato de transporte aéreo</a>, com os termos das tarifas e com as restrições de bagagens.</span></input>
                <br>
                <br>
                <button type="submit" id="continuar" class="button1" >Continuar</button>
            </form>
            <!-- /body -->
            <!--footer -->
            <footer>
                <div class="wrapper">
                    <div class="links">
                        Produzido por IT Enterprises.
                    </div>
                </div>
            </footer>
            <!--footer end-->
        </div>
    </body>
</html>